package com.xxx.auth.entity;

import com.xxx.auth.entity.enums.Status;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.validator.constraints.Length;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.io.Serializable;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Entity
@Comment("项目")
@Table(name = "t_project")
@EntityListeners(AuditingEntityListener.class)
public class Project extends TimeEntity implements Serializable {

    public static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(generator = "CustomUUID")
    @GenericGenerator(name = "CustomUUID", strategy = "com.xxx.auth.common.generator.CustomUUIDGenerator")
    @Column(name = "id", unique = true)
    private String id;

    @Column
    @Comment("名称")
    @Schema(title = "名称")
    private String name;

    @Column
    @Length(max = 500)
    @Comment("描述")
    @Schema(title = "描述")
    private String description;

    @Column
    @Comment("创建者")
    @Schema(title = "创建者")
    private String creatorId;

    @Column
    @Comment("状态：NORMAL-正常 RECYCLED-回收站 DELETED-删除")
    @Schema(title = "状态：NORMAL-正常 RECYCLED-回收站 DELETED-删除")
    @Enumerated(EnumType.STRING)
    private Status status = Status.NORMAL;

}
